package com.bluefox.proxy.d;

import com.bluefox.proxy.factory.UsbKingFactory;
import com.bluefox.proxy.service.UsbSell;

import java.lang.reflect.Proxy;

/**
 * @Author : 孙峰
 * @Description:
 * @Date : 2022/4/6  11:09
 */
public class TestMain {
    public static void main(String[] args) {
        System.getProperties().setProperty("sun.misc.ProxyGenerator.saveGeneratedFiles", "true");
        UsbKingFactory usbKingFactory = new UsbKingFactory();
        ProxyHandler proxyHandler = new ProxyHandler(usbKingFactory);
        UsbSell usbSell =(UsbSell) Proxy.newProxyInstance(usbKingFactory.getClass().getClassLoader(), usbKingFactory.getClass().getInterfaces(), proxyHandler);
        float sell = usbSell.sell(10);
        System.out.println(sell);

    }
}
